package me.exchange.com.modules.system.service;

import com.amazonaws.services.s3.model.S3ObjectSummary;
import me.exchange.com.modules.system.domain.FileContent;
import me.exchange.com.modules.system.dto.FileQueryCriteria;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/***
 * @Author zhanglf
 * @Description 云存储接口
 */
public interface AmazonService {

    List<FileContent> upload(MultipartFile[] multipartFiles);

    FileContent upload(MultipartFile multipartFiles);

    ResponseEntity<byte[]> download(String key) throws IOException;

    List<S3ObjectSummary> list();

    /**
     * 分页查询
     * @param criteria 条件
     * @param pageable 分页参数
     * @return /
     */
    Object queryAll(FileQueryCriteria criteria, Pageable pageable);

    /**
     * 查询全部
     * @param criteria 条件
     * @return /
     */
    List<FileContent> queryAll(FileQueryCriteria criteria);

    /**
     * 查询文件
     * @param id 文件ID
     * @return QiniuContent
     */
    FileContent findByContentId(Long id);
    /**
     * 导出数据
     * @param queryAll /
     * @param response /
     * @throws IOException /
     */
    void downloadList(List<FileContent> queryAll, HttpServletResponse response) throws IOException;
}
